<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */
namespace Plugin\Attractions\Inspection\Request\Inspection_exception;

use Hyperf\Validation\Request\FormRequest;

/**
 * 临时巡检验证数据类
 */
class InspectionExceptionRequest extends FormRequest
{

    public function authorize(): bool
    {
        return true;
    }


    /**
     * 新增数据验证规则
     * return array
     */
    public function rules(): array
    {
        return [
            //事件类型（“故障”、“告警”） 验证
            'type' => 'required',
            //异常时间 验证
            'date' => 'required',
            //事件内容/描述 验证
            'content' => 'required',
            //处理状态 1已处理 2未处理 3已接收 验证
            'status' => 'required',
            //巡检人 验证
            'inspector' => 'required',
            //巡检设备 验证
            'devices' => 'required'

        ];
    }


    /**
     * 字段映射名称
     * return array
     */
    public function attributes(): array
    {
        return [
            'id' => 'ID',
            'type' => '事件类型（“故障”、“告警”）',
            'date' => '异常时间',
            'content' => '事件内容/描述',
            'status' => '处理状态 1已处理 2未处理 3已接收',
            'inspector' => '巡检人',
            'devices' => '巡检设备',
            'start_time' => '巡检开始时间',
            'end_time' => '巡检结束时间',

        ];
    }

public function messages(): array
{
    return [
            'id.required' => '必填ID',
            'type.required' => '必填事件类型（“故障”、“告警”）',
            'date.required' => '必填异常时间',
            'content.required' => '必填事件内容/描述',
            'status.required' => '必填处理状态 1已处理 2未处理 3已接收',
            'inspector.required' => '必填巡检人',
            'devices.required' => '必填巡检设备'

    ];
}
}